package com.demo.androidgame.finsternis;

import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;

import android.view.KeyEvent;

import com.demo.androidgame.fx.Screen;
import com.demo.androidgame.fx.ScreenConfig;
import com.demo.androidgame.fx.impl.GLGame;
import com.demo.androidgame.finsternis.Assets;
import com.demo.androidgame.finsternis.Settings;

public class FinsternisGame extends GLGame {
	
	boolean initialized = false;
	
	//게임이 처음으로 보여줄 화면을 반환하는 메서드
	@Override
	public Screen getStartScreen() {
		return new MainMenuScreen(this);
	}
	
	@Override
	public void onSurfaceCreated(GL10 gl, EGLConfig config) {
		super.onSurfaceCreated(gl, config);
		if (initialized == false) {
			Settings.load(getFileIO());
			initialized = true;
		}
		Assets.load(this);			//리소스 로드
	}
	
	
	@Override
	public void onResume() {
		super.onResume();
		//복원 작업
	}
	
	@Override
	public void onPause() {
		super.onPause();
		if (Settings.soundEnabled)
			Assets.gameMusic.pause();
		if (Settings.soundEnabled)
			Assets.mainMusic.pause();
	}

	@Override
	public void onBackPressed() {
	}
}
